<template>
	<el-dialog title="" visible :show-close="false" :modal-append-to-body="false" class="wrap" size="tiny">
		 <div class="bt">换老师</div>
	<i class="el-icon-close close" @click="cancel" style="color: white;"></i>
		<el-form label-width="100px" class="form">
			<el-form-item label="转入老师">
				  <el-select v-model="form.zrlsgh" class="select-block">
				  <el-option :label="v.mc" :value="v.gh" v-for="v in comboxlist"></el-option>
			      </el-select>
			</el-form-item>
			<el-form-item label="转出老师">
				  <el-input v-model="form.lsmc"  icon="info" class="select-block"></el-input>

			</el-form-item>
		</el-form>
		<el-button type="info" class="submit" @click="submit">确定</el-button>
	</el-dialog>
</template>

<script type="text/javascript">
	import qs from 'qs'
	export default {
		props: ['params'],
		data() {
			return {
				form: {
					zrlsgh :'',
				},
				comboxlist: []
			}
		},
		created() {
           this.form.id=this.params.id;
           this.form.lsmc=this.params.lsmc;
           this.getcomboxlist();
//			this.loadinfo();
		},
		methods: {
//			loadinfo(){
//				 var logininfo = JSON.parse(localStorage.logininfo) ;
//				 this.axios.get(this.$store.state.api+'bj/info',{
//						 params:{
//							 xxid:logininfo.xxid,
//							 yhid:logininfo.id,
//							 id:this.form.id
//						 }
//					}).then( res =>  {
//							this.form=res.data.data
//					 }).catch(res => {
//						 alert("服务器异常");
//			 				this.$emit('close', { type: 'info', cancel: true });
//					 })
//			},
			cancel() {
				this.$emit('close', { type: 'hls', cancel: true })
			},
				submit() {
				//检测
				this.$store.state.loading = true;
				//装载数据
				var logininfo = JSON.parse(localStorage.logininfo);
				var params2 = qs.stringify({
					bjid: this.form.id+'',
					zrlsgh: this.form.zrlsgh+'',
					zclsid: this.form.id+''
				})
				//执行
				this.axios.post(this.$store.state.api + 'bj/hls', params2)
					.then(res => {
						if(res.data.code == 1) {
							this.$emit('close', { type: 'hls', cancel: false });
							this.$store.state.loading = false;
						} else {
							this.$emit('close', { type: 'hls', cancel: false });
							this.$store.state.loading = false;
						}
					}).catch(res => {
						this.$message.warning("服务器异常");
						this.$store.state.loading = false;
					})
			},
			getcomboxlist() {
				var logininfo = JSON.parse(localStorage.logininfo);
				this.searchLoading = true;
				this.axios.get(this.$store.state.api + 'ls/getlslist', {
					params: {
						yhid: logininfo.id,
						xxid: logininfo.xxid
					}
				}).then(res => {
					console.log(res)
					let data = res.data.data;
					let list = data.list;
					this.comboxlist = list;
					console.log(this.comboxlist)
				}).catch(res => {
					console.log(res)
					this.searchLoading = false;
				})
			},
		}
	}
</script>

<style lang="less" scoped>
	.wrap {
		text-align: center;
	}
	.form {
		text-align: left;
		margin-top: 20px;
	}
	 .input {
            width: 300px;
            display: inline-block;
        }
     .close {
		    position: absolute;
		    top: 18px;
		    right: 20px;
		    color: #8492A6;
		    font-size: 16px;
        }
	.select-block {
		display: block;
		width: 85%;
	}
    .bt{
			position: absolute;
			width: 100%;
			height: 50px;
			margin: 0 auto;
			background: #50BFFF;
			top:0;
			left:0;
			color:white;
			text-align:left;
			line-height: 50px;
			font-size: 17px;
			padding-left: 15px;
		}
	.submit {
		width: 120px;
	}
</style>
